<template>
  <div class="app-container">
    <div class="filter-container">
      <el-form :inline="true" :model="formModel">
        <el-form-item class="no-warn-item" label="用户登录名:" prop="username">
          <el-input
            v-model="formModel.username"
            clearable
          />
        </el-form-item>
        <el-form-item class="no-warn-item" label="员工号:" prop="engineerCode">
          <el-input
            v-model="formModel.engineerCode"
            clearable
          />
        </el-form-item>
        <el-form-item class="no-warn-item" label="真实姓名:" prop="realName">
          <el-input
            v-model="formModel.realName"
            clearable
          />
        </el-form-item>
        <el-form-item class="no-warn-item" label="所属部门:" prop="depId">
          <el-input
            v-model="formModel.depId"
            disabled
            clearable
          />
        </el-form-item>
        <el-row class="submit-area">
          <el-col :span="24">
            <el-button type="primary" plain @click="queryList">查询</el-button>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <hey-table ref="table" @row-click="handleRowClick" :columns="columns" :is-radio="true">

    </hey-table>
    <el-row class="submit-area">
      <el-col :span="24">
        <el-button @click="closeDialog">取消</el-button>
        <el-button type="primary" @click="handleSubmit()">确定</el-button>
      </el-col>
    </el-row>
  </div>
</template>

<script>
  export default {
    name: 'UserDialog',
    props: {

    },
    data() {
      return {
        chooseData:{},
        formModel: {
          username: '',
          isDelete: '0',
          engineerCode: '',
          realName: '',
          depId: '',
        },
        columns: [
          { title: '用户登录名', key: 'username'},
          { title: '员工号', key: 'engineerCode'},
          { title: 'SAP用户名', key: 'sapUsername'},
          { title: '真实姓名', key: 'realName'},
          { title: '用户描述', key: 'description'},
          { title: '所属部门', key: 'depName'},
          { title: '办公地址', key: 'officeLocation'},
          { title: '电话号码', key: 'telephone'},
          { title: '电子邮件', key: 'email'},
          { title: '传真', key: 'userFax'},
          { title: '登录状态', key: 'loginStatus'},
          { title: '最后登录时间', key: 'lastLoginTime'},
          { title: '角色名称', key: 'roleName'},
          { title: '创建时间', key: 'createTime' },
          { title: '创建人', key: 'createUsername' },
          { title: '最后修改时间', key: 'lastUpdateTime'},
          { title: '最后修改人', key: 'lastUpdateUsername' },
        ],
        rules: {
        }
      }
    },
    computed: {

    },
    mounted() {

    },
    methods: {
      handleSubmit() {
        if(Object.keys(this.chooseData).length==0){
          this.$warn('请单击选中一条数据!')
          return false
        }
        this.$emit('queryUserSuc', this.chooseData)
        this.closeDialog()
      },
      handleRowClick(row){
        this.chooseData = row
      },
      queryList() {
        this.$refs.table.query('/user/queryTmSysUser', this.formModel, '', false)
      },
      closeDialog() {
        this.$parent.$emit('update:visible', false)
      }
    }
  }
</script>

<style lang="scss" scoped>

</style>
